package cn.wps.moffice.common.shareplay2; import android.app.Activity; import android.content.ClipboardManager; import android.content.Context; import android.content.res.Resources; import android.graphics.Bitmap; import android.os.Build; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ListAdapter; import android.widget.ListView; import android.widget.TextView; import cn.wps.moffice.OfficeApp; import cn.wps.moffice_eng.R; import com.fasterxml.jackson.core.util.MinimalPrettyPrinter; import defpackage.hbd; import defpackage.kid; import java.util.ArrayList; import java.util.HashMap; public class SharePlayPopupView extends LinearLayout implements View.OnClickListener, ecy { private String mAccessCode; private TextView mAccessCodeView; private Runnable mAfterClickShare; private TextView mArgoOnLineNumViw; private Context mContext; private View mCopyAccessCodeView; private TextView mCopyUrlImg; private int mCurOnlineNum; private View mInviteRootView; private TextView mInviteTitleView; private View mInviteToUserListView; private HashMap<String, khj<String>> mItemHashMap; private TextView mQQShareImg; private ImageView mQrcodeImg; private View mQrcodeLayout; private View mShareLayout; private SharePlayUsersAdapter mSharePlayUsersAdapter; private edc mShareplayControler; private String mUserId; private View mUserListBackView; private TextView mUserListJoinNumView; private View mUserListRootView; private View mUserListToInviteView; private ListView mUserListView; private TextView mWeChatShareImg; public SharePlayPopupView(Context context) { super(context); this.mContext = context; initView(this.mContext); } private void backToLastView() { this.mUserListRootView.setVisibility(8); this.mInviteRootView.setVisibility(0); } private String checkAccessCode(String str) { if (TextUtils.isEmpty(str)) { return ""; } if (str.length() < 10) { return str; } StringBuffer stringBuffer = new StringBuffer(str); stringBuffer.insert(3, MinimalPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR).insert(7, MinimalPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR); return stringBuffer.toString(); } private void handleShareClick(String str) { khj<String> khj = this.mItemHashMap.get(str); if (khj != null) { khj.ae(""); } if (this.mAfterClickShare != null) { this.mAfterClickShare.run(); } } private void initView(Context context) { View inflate = LayoutInflater.from(context).inflate(luf.gR(context) ? R.layout.public_shareplay_play_pad_info : R.layout.public_shareplay_play_info, (ViewGroup) this, true); this.mQrcodeLayout = inflate.findViewById(R.id.shareplay_qrcode_layout); this.mUserListView = (ListView) inflate.findViewById(R.id.shareplay_userlist_listview); this.mShareLayout = inflate.findViewById(R.id.ppt_shareplay_share_layout); this.mQrcodeImg = (ImageView) inflate.findViewById(R.id.public_shareplay_popup_qrcode_img); this.mAccessCodeView = (TextView) inflate.findViewById(R.id.public_shareplay_popup_access_code); this.mArgoOnLineNumViw = (TextView) inflate.findViewById(R.id.shareplay_argo_user_num); this.mWeChatShareImg = (TextView) inflate.findViewById(R.id.ppt_shareplay_wechat_share); this.mQQShareImg = (TextView) inflate.findViewById(R.id.ppt_shareplay_qq_share); this.mCopyUrlImg = (TextView) inflate.findViewById(R.id.ppt_shareplay_copy_url); this.mUserListRootView = inflate.findViewById(R.id.shareplay_userlist_layout); this.mInviteRootView = inflate.findViewById(R.id.shareplay_invite_layout); this.mCopyAccessCodeView = inflate.findViewById(R.id.shareplay_copy_accesscode); this.mUserListView = (ListView) inflate.findViewById(R.id.shareplay_userlist_listview); this.mSharePlayUsersAdapter = new SharePlayUsersAdapter(this.mContext); this.mUserListToInviteView = inflate.findViewById(R.id.shareplay_userlist_to_invite); this.mInviteToUserListView = inflate.findViewById(R.id.shareplay_invite_to_userlist); this.mUserListBackView = inflate.findViewById(R.id.shareplay_userlist_back); this.mInviteTitleView = (TextView) inflate.findViewById(R.id.shareplay_invite_has_join_title); this.mUserListJoinNumView = (TextView) inflate.findViewById(R.id.shareplay_userlist_join_num); this.mUserListToInviteView.setOnClickListener(this); this.mInviteToUserListView.setOnClickListener(this); this.mUserListBackView.setOnClickListener(this); this.mUserListView.setAdapter((ListAdapter) this.mSharePlayUsersAdapter); this.mCopyAccessCodeView.setOnClickListener(this); } private void onClickCopyAccessCode(String str) { if (Build.VERSION.SDK_INT > 11) { ((ClipboardManager) this.mContext.getSystemService("clipboard")).setText(str); } else { ((android.text.ClipboardManager) this.mContext.getSystemService("clipboard")).setText(str); } lvg.d(this.mContext, R.string.ppt_shareplay_has_copy_accesscode, 0); if (this.mAfterClickShare != null) { this.mAfterClickShare.run(); } } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void processUserListData(final tgm tgm) { fcz.b(new Runnable() { /* class cn.wps.moffice.common.shareplay2.SharePlayPopupView.AnonymousClass3 */ public void run() { if (tgm != null && tgm.uFe != null) { ArrayList<Long> arrayList = tgm.uFg; SharePlayPopupView.this.mSharePlayUsersAdapter.setUserArrayList(tgm.uFe); SharePlayPopupView.this.mSharePlayUsersAdapter.setArgoList(tgm.uFg); SharePlayPopupView.this.mSharePlayUsersAdapter.setCreatorId(tgm.uFf); SharePlayPopupView.this.mSharePlayUsersAdapter.setSpeakerId(tgm.uFa); SharePlayPopupView.this.mSharePlayUsersAdapter.setCurUserId(SharePlayPopupView.this.mUserId); SharePlayPopupView.this.mSharePlayUsersAdapter.notifyDataSetChanged(); if (arrayList != null) { SharePlayPopupView.this.mCurOnlineNum = arrayList.size(); } else { SharePlayPopupView.this.mCurOnlineNum = 0; } SharePlayPopupView.this.mArgoOnLineNumViw.setText(SharePlayPopupView.this.mContext.getString(R.string.ppt_shareplay_argoing_num, Integer.valueOf(SharePlayPopupView.this.mCurOnlineNum))); } } }, false); } private SharePlayPopupView setAccessCode(String str) { this.mAccessCodeView.setText(checkAccessCode(str)); return this; } private SharePlayPopupView setChineseVersion(boolean z) { int i = 0; this.mQrcodeLayout.setVisibility(z ? 0 : 8); View view = this.mShareLayout; if (!z) { i = 8; } view.setVisibility(i); return this; } private SharePlayPopupView setQrCode(Bitmap bitmap) { this.mQrcodeImg.setImageBitmap(bitmap); return this; } @Override // defpackage.ecy public void getUserList(String str) { this.mUserId = str; this.mArgoOnLineNumViw.setText(this.mContext.getString(R.string.ppt_shareplay_argoing_num, Integer.valueOf(this.mCurOnlineNum))); this.mUserListRootView.setVisibility(0); this.mInviteRootView.setVisibility(8); fcx.p(new Runnable() { /* class cn.wps.moffice.common.shareplay2.SharePlayPopupView.AnonymousClass1 */ public void run() { if (SharePlayPopupView.this.mShareplayControler != null && !TextUtils.isEmpty(SharePlayPopupView.this.mAccessCode) && !TextUtils.isEmpty(SharePlayPopupView.this.mUserId)) { SharePlayPopupView.this.processUserListData(SharePlayPopupView.this.mShareplayControler.getSharePlayUserList(SharePlayPopupView.this.mUserId, SharePlayPopupView.this.mAccessCode)); } } }); } @Override // defpackage.ecy public ecy init(Activity activity, boolean z, String str, Bitmap bitmap, edc edc, String str2) { setChineseVersion(z).setAccessCode(str).setQrCode(bitmap); this.mAccessCode = str; this.mUserId = str2; this.mShareplayControler = edc; if (OfficeApp.arx().arQ()) { this.mShareLayout.setVisibility(0); } else { this.mShareLayout.setVisibility(8); } initShare(activity, str); return this; } public void initShare(Activity activity, String str) { boolean z = true; if (eda.eDX == null) { eda.eDX = new eda(); } eda eda = eda.eDX; if (eda.eDY == null) { eda.eDY = new gtn(activity); eda.eDY.icon = ""; eda.eDY.desc = activity.getString(R.string.public_shareplay_invite_weichat_content); } eda.eDY.setTitle(activity.getString(R.string.public_shareplay_invite_weichat_title, new Object[]{edf.nw(str)})); eda.eDY.setUrl("https://tv.wps.cn/share/shareplay?code=" + str); if (eda.eDZ == null) { eda.eDZ = new gtr(activity); } eda.eDZ.init(activity.getString(R.string.public_shareplay_invite_weichat_title, new Object[]{edf.nw(str)}), activity.getString(R.string.public_shareplay_invite_weichat_content), "https://tv.wps.cn/share/shareplay?code=" + str, null); HashMap<String, khj<String>> hashMap = new HashMap<>(); Resources resources = OfficeApp.arx().getResources(); if (lwd.hu(OfficeApp.arx()) && (OfficeApp.arx().getPackageName().equals("cn.wps.moffice_eng") || OfficeApp.arx().getPackageName().equals("cn.wps.moffice")) && (gtk.xk("com.tencent.mobileqq") || gtk.xk("com.tencent.tim"))) { String string = resources.getString(R.string.ppt_shareplay_qq_share); hashMap.put(string, new hbd.a(string, resources.getDrawable(R.drawable.home_scf_folder_icon_qq), null) { /* class defpackage.eda.AnonymousClass1 */ /* access modifiers changed from: protected */ @Override // defpackage.hbd.a public final boolean aUx() { dwp.km("shareplay_invite_QQ"); eda.this.eDZ.shareToQQ(); return true; } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ /* access modifiers changed from: protected */ @Override // defpackage.hbd.a, defpackage.khi public final /* synthetic */ boolean z(String str) { return aUx(); } }); } if (!lwd.hu(OfficeApp.arx()) || ((!OfficeApp.arx().getPackageName().equals("cn.wps.moffice_eng") && !OfficeApp.arx().getPackageName().equals("cn.wps.moffice")) || !gtk.bUu())) { z = false; } if (z) { String string2 = resources.getString(R.string.ppt_shareplay_wechat_share); hashMap.put(string2, new hbd.a(string2, resources.getDrawable(R.drawable.phone_public_send_wechat_friend), null) { /* class defpackage.eda.AnonymousClass2 */ /* access modifiers changed from: protected */ @Override // defpackage.hbd.a public final boolean aUx() { dwp.km("shareplay_invite_WeChat"); eda.this.eDY.shareToFrends(); return true; } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ /* access modifiers changed from: protected */ @Override // defpackage.hbd.a, defpackage.khi public final /* synthetic */ boolean z(String str) { return aUx(); } }); } String string3 = activity.getString(R.string.ppt_shareplay_copy_url); kid kid = new kid(activity, string3, resources.getDrawable(R.drawable.public_share_copy_link), null); kid.mfr = new kid.a(str) { /* class defpackage.eda.AnonymousClass3 */ final /* synthetic */ String val$accessCode; { this.val$accessCode = r2; } @Override // defpackage.kid.a public final String aUy() { dwp.km("shareplay_invite_copylink"); return "https://tv.wps.cn/share/shareplay?code=" + this.val$accessCode; } }; hashMap.put(string3, kid); this.mItemHashMap = hashMap; String string4 = this.mContext.getString(R.string.ppt_shareplay_qq_share); if (this.mItemHashMap == null || this.mItemHashMap.get(string4) == null) { this.mQQShareImg.setVisibility(8); } else { this.mQQShareImg.setVisibility(0); } String string5 = this.mContext.getString(R.string.ppt_shareplay_wechat_share); if (this.mItemHashMap == null || this.mItemHashMap.get(string5) == null) { this.mWeChatShareImg.setVisibility(8); } else { this.mWeChatShareImg.setVisibility(0); } this.mCopyUrlImg.setVisibility(0); this.mQQShareImg.setOnClickListener(this); this.mWeChatShareImg.setOnClickListener(this); this.mCopyUrlImg.setOnClickListener(this); } public void onClick(View view) { switch (view.getId()) { case R.id.ppt_shareplay_copy_url /*{ENCODED_INT: 2131366851}*/: handleShareClick(this.mContext.getString(R.string.ppt_shareplay_copy_url)); return; case R.id.ppt_shareplay_qq_share /*{ENCODED_INT: 2131366854}*/: handleShareClick(this.mContext.getString(R.string.ppt_shareplay_qq_share)); return; case R.id.ppt_shareplay_wechat_share /*{ENCODED_INT: 2131366857}*/: handleShareClick(this.mContext.getString(R.string.ppt_shareplay_wechat_share)); return; case R.id.shareplay_copy_accesscode /*{ENCODED_INT: 2131368070}*/: onClickCopyAccessCode(this.mAccessCode); return; case R.id.shareplay_invite_to_userlist /*{ENCODED_INT: 2131368075}*/: getUserList(this.mUserId); return; case R.id.shareplay_userlist_back /*{ENCODED_INT: 2131368079}*/: backToLastView(); return; case R.id.shareplay_userlist_to_invite /*{ENCODED_INT: 2131368083}*/: backToLastView(); return; default: return; } } @Override // defpackage.ecy public void setAfterClickShare(Runnable runnable) { this.mAfterClickShare = runnable; } @Override // defpackage.ecy public ecy setPeopleCount(int i) { String string = this.mContext.getString(R.string.ppt_shareplay_has_join_num, Integer.valueOf(i)); String string2 = this.mContext.getString(R.string.ppt_shareplay_has_join_num_userlist, Integer.valueOf(i)); this.mInviteTitleView.setText(string); this.mUserListJoinNumView.setText(string2); return this; } @Override // defpackage.ecy public void updateUserList(String str) { this.mUserId = str; this.mArgoOnLineNumViw.setText(this.mContext.getString(R.string.ppt_shareplay_argoing_num, Integer.valueOf(this.mCurOnlineNum))); fcx.p(new Runnable() { /* class cn.wps.moffice.common.shareplay2.SharePlayPopupView.AnonymousClass2 */ public void run() { if (SharePlayPopupView.this.mShareplayControler != null && !TextUtils.isEmpty(SharePlayPopupView.this.mAccessCode) && !TextUtils.isEmpty(SharePlayPopupView.this.mUserId)) { SharePlayPopupView.this.processUserListData(SharePlayPopupView.this.mShareplayControler.getSharePlayUserList(SharePlayPopupView.this.mUserId, SharePlayPopupView.this.mAccessCode)); } } }); } }